1 module hip.jni.android.data_space;
2 
3 /*
4  * Copyright 2018 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /**
20  * @file data_space.h
21  */
22 
23 
24 
25 // #include <inttypes.h>
26 
27 /**
28  * ADataSpace.
29  */
30 enum ADataSpace {
31     /**
32      * Default-assumption data space, when not explicitly specified.
33      *
34      * It is safest to assume the buffer is an image with sRGB primaries and
35      * encoding ranges, but the consumer and/or the producer of the data may
36      * simply be using defaults. No automatic gamma transform should be
37      * expected, except for a possible display gamma transform when drawn to a
38      * screen.
39      */
40     ADATASPACE_UNKNOWN = 0,
41 
42     /**
43      * scRGB linear encoding:
44      *
45      * The red, green, and blue components are stored in extended sRGB space,
46      * but are linear, not gamma-encoded.
47      * The RGB primaries and the white point are the same as BT.709.
48      *
49      * The values are floating point.
50      * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
51      * Values beyond the range [0.0 - 1.0] would correspond to other colors
52      * spaces and/or HDR content.
53      */
54     ADATASPACE_SCRGB_LINEAR = 406913024, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED
55 
56     /**
57      * sRGB gamma encoding:
58      *
59      * The red, green and blue components are stored in sRGB space, and
60      * converted to linear space when read, using the SRGB transfer function
61      * for each of the R, G and B components. When written, the inverse
62      * transformation is performed.
63      *
64      * The alpha component, if present, is always stored in linear space and
65      * is left unmodified when read or written.
66      *
67      * Use full range and BT.709 standard.
68      */
69     ADATASPACE_SRGB = 142671872, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL
70 
71     /**
72      * scRGB:
73      *
74      * The red, green, and blue components are stored in extended sRGB space,
75      * and gamma-encoded using the SRGB transfer function.
76      * The RGB primaries and the white point are the same as BT.709.
77      *
78      * The values are floating point.
79      * A pixel value of 1.0, 1.0, 1.0 corresponds to sRGB white (D65) at 80 nits.
80      * Values beyond the range [0.0 - 1.0] would correspond to other colors
81      * spaces and/or HDR content.
82      */
83     ADATASPACE_SCRGB = 411107328, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED
84 
85     /**
86      * Display P3
87      *
88      * Use same primaries and white-point as DCI-P3
89      * but sRGB transfer function.
90      */
91     ADATASPACE_DISPLAY_P3 = 143261696, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL
92 
93     /**
94      * ITU-R Recommendation 2020 (BT.2020)
95      *
96      * Ultra High-definition television
97      *
98      * Use full range, SMPTE 2084 (PQ) transfer and BT2020 standard
99      */
100     ADATASPACE_BT2020_PQ = 163971072, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL
101 
102     /**
103      * Adobe RGB
104      *
105      * Use full range, gamma 2.2 transfer and Adobe RGB primaries
106      * Note: Application is responsible for gamma encoding the data as
107      * a 2.2 gamma encoding is not supported in HW.
108      */
109     ADATASPACE_ADOBE_RGB = 151715840, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL
110 
111     /**
112      * ITU-R Recommendation 2020 (BT.2020)
113      *
114      * Ultra High-definition television
115      *
116      * Use full range, BT.709 transfer and BT2020 standard
117      */
118     ADATASPACE_BT2020 = 147193856, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_FULL
119 
120     /**
121      * ITU-R Recommendation 709 (BT.709)
122      *
123      * High-definition television
124      *
125      * Use limited range, BT.709 transfer and BT.709 standard.
126      */
127     ADATASPACE_BT709 = 281083904, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED
128 
129     /**
130      * SMPTE EG 432-1 and SMPTE RP 431-2.
131      *
132      * Digital Cinema DCI-P3
133      *
134      * Use full range, gamma 2.6 transfer and D65 DCI-P3 standard
135      * Note: Application is responsible for gamma encoding the data as
136      * a 2.6 gamma encoding is not supported in HW.
137      */
138     ADATASPACE_DCI_P3 = 155844608, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL
139 
140     /**
141      * sRGB linear encoding:
142      *
143      * The red, green, and blue components are stored in sRGB space, but
144      * are linear, not gamma-encoded.
145      * The RGB primaries and the white point are the same as BT.709.
146      *
147      * The values are encoded using the full range ([0,255] for 8-bit) for all
148      * components.
149      */
150     ADATASPACE_SRGB_LINEAR = 138477568, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL
151 }